import hashlib

# pip install pyexecjs
import execjs
import requests

with open("加解密.js", "r", encoding="utf8") as f:
    content = f.read()
    js_code = execjs.compile(content)

    payload = {
        "sort": 1,
        "start": 10,
        "limit": 20
    }

    payload_str = js_code.call("get_payload", payload)
    _p = js_code.call("get_p")
    sig = hashlib.md5(f"{payload_str}{_p}".encode()).hexdigest().upper()

    data = {
        "payload": payload_str,
        "sig": sig,
        "v": 1
    }
    res = requests.post("https://www.xiniudata.com/api2/service/x_service/person_industry_list/list_industries_by_sort",
                        json=data)

    data = res.json()
    result = js_code.call("get_data", data['d'])
    for item in result['list']:
        print(item)


